<style type="text/css">
.carousel-inner .item img{
	max-width: 100%;
    max-height: 100%;
    vertical-align: middle;
	height:82px;
}
.star-rate {margin-left:0}
.fe-floatright-bottom a {
    display: block;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 100%;
    background-color: #ff9999;
    color: #fff;
    line-height: 0.7rem;
	font-size:0.45rem;
    margin: 0.5rem auto;
    margin-right: 0;
}
.fe-floatright-bottom a .icon {
    color: #fff;
    font-size: 0.6rem;
    height: 0.6rem;
	line-height: 1rem;
    opacity: 1;
}
</style>

<div class="fui-page-group ">
<div class="fui-page  fui-page-current page-goods-list">
	<div class="fui-header">
		<div class="fui-header-left" ng-click="pagedata.showarea =1">
			<span ng-show="pagedata.pcd.district" style="font-size:0.65rem">{{pagedata.pcd.district}}</span>
			<span ng-show="!pagedata.pcd.district" style="font-size:0.65rem">{{pagedata.pcd.city || '广州市'}}</span>
			<i class="icon jinyunicon icon-moreunfold"></i>
		</div>
		<div class="title">
			<form method="post">
					<div class="searchbar searchbar-active" style="margin-left:3.2rem;margin-right:0.5rem">
					<div class="search-input">
						<i id="searchsub" class="icon jinyunicon icon-search" ng-click="access(pagedata.op,made_query(pagedata.params))" style="font-size: 1.0rem;"></i>
						<input type="search" id="search" placeholder="输入关键字..." ng-model="pagedata.keyword" ng-click="getlist(pagedata.keyword)">
					</div>
					</div>
			</form>
		</div>
    </div>
	
	<div id="carousel-container" class="carousel slide" data-role="carousel" data-param-auto="true" style="margin-top:2.5rem">
			<div class="carousel-inner" role="listbox" style="height:6rem">
			<div ng-class="{'item':1,'active':$index==0}" ng-repeat="item in pagedata.hdps">
				
				<a href="#">
					<img src="{{tomedia(item.picurl) || '../core/resource/images/banner-1.jpg'}}" style="display: block; width: 100%; height: 100%;">
				</a>
			</div>
			</div>
				<style>
						.fui-swipe-page .fui-swipe-bullet {background: {background}; opacity: {opacity};}
						.fui-swipe-page .fui-swipe-bullet.active {opacity: 1;}
				</style>
				<div id="carousel-jinyun" class="fui-swipe-page" style="padding: 0 5px; bottom: 10px; ">
					<div class="fui-swipe-bullet" ng-repeat="item in pagedata.hdps" ng-class="{'active':$index==0}" data-target="#carousel-container" data-slide-to="{{$index}}"></div>
				</div>
	</div>
	<div class="fui-icon-group noborder col-5" style="background: #ffffff">
			<a class="fui-icon-col external"  href="javascript:;" ng-click="access_json('jy_bdd/index/main/')" data-nocache="true">
				<div class="icon"><img ng-src="{{'../core/resource/images/diy/icon/icon-1.png'}}"></div>
				<div class="text" style="color: #666666;">全部</div>
			</a>
			<a class="fui-icon-col external" ng-repeat="item in pagedata.group" href="javascript:;" ng-click="access_json('jy_bdd/index/main/groupid='+item.id)" data-nocache="true">
				<div class="icon"><img ng-src="{{tomedia(item.image) || '../core/resource/images/nopic.jpg'}}"></div>
				<div class="text" style="color: #666666;">{{item.title}}</div>
			</a>
	</div>
	<div class="sort" style="top:0.2rem">
		<div class="item" ng-class="{'on':pagedata.status==0}" ng-click="getlist('zhonghe')"><span class="text">综合</span></div>
		<div class="item" ng-class="{'on':pagedata.status==1}" data-order="sales" href="javascript:" ng-click="getlist('juli')"><span class="text">距离</span></div>
		<div class="fui-list-group merchgroup" ng-repeat="item in pagedata.list" >
            <div class="fui-list">
                <a class="fui-list-media storelogo" href="javascript:;" ng-click="access_json('/store_detail//id='+item.id)">
                    <img class="round" ng-src="{{tomedia(item.image) || '../core/resource/images/nopic.jpg'}}">
                </a>
                <a class="fui-list-inner" style="margin-top:0.16rem" href="javascript:;" ng-click="access_json('/store_detail//id='+item.id)">
                    <div class="title" style="font-size:0.76rem"><span>{{item.title}}</span></div>
                    <div class="store-star">
						<span class="star-rate">{{item.desc || '该门店还没有添加描述！'}}</span>
					</div>
					<div class="subtitle" style="font-size:0.55rem">
						<div class="store-moneylimit">
						  <span>距您{{item.juli}}公里</span>
						  <span class="store-distance"> 电话：{{item.phone || '无'}}</span>
						</div>
					</div>
                </a>
            </div>
		</div>
		<div ng-show="loading" class='infinite-loading'><span class='fui-preloader'></span><span style="margin-left:1.5rem"> 正在加载...</span></div>
    </div>
</div>
</div>
<div class="fui-page  fui-page-current page-goods-list" ng-if="pagedata.showarea ==1">
<div class="fui-header">
		<div class="fui-header-left" ng-click="pagedata.showarea =0">
			<a class="back"></a>
		</div>
		<div class="title">
			<form method="post">
					<div class="searchbar searchbar-active">
					<div class="search-input">
						<i class="icon jinyunicon icon-search" style="font-size: 1.0rem;"></i>
						<input type="search" id="search" placeholder="输入关键字..." value="">
					</div>
					</div>
			</form>
		</div>
		<div class="fui-header-right" data-nomenu="true">
			<a href="javascript:;"><i class="icon jinyunicon icon-saoyisao2" id="listblock" style="font-size: 1.0rem;"></i></a>
		</div>
</div>
<div class="fui-content" style="top:1.3rem">
		<div class="weui_cells weui_cells_access">
				<a class="weui_cell" href="javascript:;">
					<div class="weui_cell_bd weui_cell_primary" style="padding:0">
						<span>当前定位/选择地区：{{pagedata.pcd.city || '广州市'}}</span>
					</div>
					<div class="weui_cell_ft" ng-click="toogle(post,'show')">
						选择县区
					</div>
				</a>
				<div class="row margin0" ng-show="post.show">
						<div class="jy-3" ng-repeat="value in pagedata.province[pagedata.pcd.province][pagedata.pcd.city]">
							<div class="yuyue-duan" style="width:auto" ng-click="selectarea(pagedata.pcd.province,pagedata.pcd.city,value);pagedata.showarea = 0;">
									<div>{{value}}</div>
									<div class="clear"></div>
							</div>
						</div>
				</div>
			</div>
			<div class="weui_cells_title">热门地区</div>
			<div class="weui_cells">
				<div class="row margin0">
					<div class="jy-3">
							<div class="yuyue-duan" style="width:auto" ng-click="selectarea('广东省','深圳市','');pagedata.showarea = 0;">
									<div>深圳市</div>
									<div class="clear"></div>
							</div>
						</div>
						<div class="jy-3">
							<div class="yuyue-duan" style="width:auto" ng-click="selectarea('上海市','上海市','');pagedata.showarea = 0;">
									<div>上海市</div>
									<div class="clear"></div>
							</div>
						</div>
						<div class="jy-3">
							<div class="yuyue-duan" style="width:auto" ng-click="selectarea('广东省','东莞市','');pagedata.showarea = 0;">
									<div>东莞市</div>
									<div class="clear"></div>
							</div>
						</div>
						<div class="jy-3">
							<div class="yuyue-duan" style="width:auto" ng-click="selectarea('北京市','北京市','');pagedata.showarea = 0;">
									<div>北京市</div>
									<div class="clear"></div>
							</div>
						</div>
						<div class="jy-3">
							<div class="yuyue-duan" style="width:auto" ng-click="selectarea('江苏省','南京市','');pagedata.showarea = 0;">
									<div>南京市</div>
									<div class="clear"></div>
							</div>
						</div>
						<div class="jy-3">
							<div class="yuyue-duan" style="width:auto" ng-click="selectarea('江苏省','杭州市','');pagedata.showarea = 0;">
									<div>杭州市</div>
									<div class="clear"></div>
							</div>
						</div>
				</div>
			</div>
			<div ng-repeat="(value,data) in pagedata.province">
				<div class="weui_cells_title">{{value}}</div>
				<div class="weui_cells">
					<div class="row margin0">
						<div class="jy-3" ng-repeat="(city,data) in pagedata.province[value]">
								<div class="yuyue-duan" style="width:auto" ng-click="selectarea(value,city,'');pagedata.showarea = 0;">
										<div>{{city}}</div>
										<div class="clear"></div>
								</div>
						</div>
					</div>
				</div>
		    </div>
</div>
</div>
<div ng-include="sys_html('_footer')"></div>
<script type="text/javascript">
require(['bootstrap', 'hammer'], function($, Hammer){
		$('#carousel-container').carousel();
		var mc = new Hammer($('#carousel-container').get(0));
		mc.on("panleft", function(ev) {
			$('#carousel-container').carousel('next');
		});
		mc.on("panright", function(ev) {
			$('#carousel-container').carousel('prev');
		});
	}); 
//手机软键盘--搜索
$("body").keydown(function() {
    if (event.keyCode == "13") {
        $('#searchsub').click();
    }
});
scope.loading = true;
    // 百度地图API功能
window.scope.location(function(re){
	if(!scope.pagedata.pcd.city){
		scope.$apply(function(){
			scope.pagedata.pcd.province = re.addressComponents.province;
			scope.pagedata.pcd.city = re.addressComponents.city;
		});
	}
	scope.pagedata.lat_lng=re.lat_lng
	var data={
	'data':{'lat_lng':re.lat_lng},
	'op':'getlist',
	};
	data.callback=function(d){
		window.scope.pagedata.list=d.list;
		scope.loading = false;
		scope.$apply();
	}
	window.scope.post_json(data);
});
scope.selectarea = function(province,city,district){
	//scope.$apply(function(){
		scope.pagedata.pcd.province = province;
		scope.pagedata.pcd.city = city;
		scope.pagedata.pcd.district = district;
		scope.getlist('',province,city);
	//});
}	
scope.scroll(function(){
		scope.$apply();
		setTimeout('getlist()',2000);
},false,'svposttext');
var page = 1;
scope.getlist=function (key,province,city){
	if(key){
		page=1
		scope.pagedata.list=[]
	}
	var params = {
				'plugin':'jy_bdd',
				'action':'store_list',
				'op':'getlist',
				'data':{
						'keyword':key?key:'',
						'province':province,
						'city':city,
						'lat_lng':scope.pagedata.lat_lng
				},
				'callback':function(data){
							if(data.error !=1){
							 for (var i=0;i<data.list.length;i++){
									scope.pagedata.list.push(data.list[i]);
								}
								if(page >1){
									$(".merchgroup").animate({scrollTop:0},300);
								}
								page++;
								scope.loading = false;
								window.scope.pagedata.list=data.list;
								scope.$apply();
							}else{
								onsole.log('error');
							};
				}
	}
	scope.post_json(params);
} 
//手机软键盘--搜索
$("body").keydown(function() {
    if (event.keyCode == "13") {
        $('#searchsub').click();
    }
});
</script>